<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"	
	template="/pages/plantilla.xhtml">
	
	<ui:define name="title">SISPAGOS | Recaudacion</ui:define>
	<ui:define name="contenido" >
	<f:view>
		<h:form id="formCxC">
		<p:growl id="growl" showDetail="true" life="10000" />
	        <p:fieldset>
	        <table><tr>
	        <td valign="top"><h:outputText value="Codigo Alumno"/></td>
	        <td valign="baseline"><p:inputText value="#{gestionCxCController.alumno.codigoMatricula}"/></td>
	        <td valign="top">
	        <p:commandButton value="Cargar Recaudacion" actionListener="#{gestionCxCController.cargarCxCxCodAlumno}" update="dtCxC, btnReporte"/>
	        </td></tr></table>
	        </p:fieldset>
	        <p:fieldset>
	        <table style="width:100%">
	        <tr>
	        <td align="left">
	        <p:commandButton value="Agregar Cta por Cobrar de tipo Debe" oncomplete="dlgCtaDebe.show();"
	        actionListener="#{gestionCxCController.inicializarCtaDebe}" update="opCxC"/>
	        </td>
	        <td align="right">
	        <p:commandButton value="Guadar Constancia" actionListener="#{gestionCxCController.guardarConstancia}"
	        update="growl"/>
	        <p:commandButton  id="btnReporte" icon="ui-icon-document"
	    	value="Generar Constancia: #{gestionCxCController.alumno.codigoMatricula}"
	    	ajax="true" onclick="window.open('#{loginController.rutaSoloRaizServidor}/birtViewer/frameset?__report=constanciaCxC.rptdesign&amp;param_codalumno=#{gestionCxCController.alumno.codigoMatricula}','nuevaVentana','width=700, height=400')">
			</p:commandButton>
	        </td>
	        </tr>
	        </table>
	        <p:dataTable id="dtCxC" value="#{gestionCxCController.cxcAlumno}" var="cxc" 
	        paginator="true" 
            paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
            rowsPerPageTemplate="5,10,15" rows="10" editable="true" editMode="cell">
	        	<p:column headerText="Semeste">
		            <p:cellEditor>  
		                <f:facet name="output"><h:outputText value="#{cxc.semestre}" /></f:facet>  
		                <f:facet name="input">  
		                    <h:selectOneMenu value="#{cxc.semestre}" style="width:100%">  
		                    	<f:selectItem itemValue="" itemLabel="Sin Semestre"/>
		                        <f:selectItem itemValue="Semestre 0" itemLabel="Semestre 0"/>
		                        <f:selectItem itemValue="Semestre 1" itemLabel="Semestre 1"/>
		                        <f:selectItem itemValue="Semestre 2" itemLabel="Semestre 2"/>  
		                    </h:selectOneMenu>  
		                </f:facet>  
		            </p:cellEditor> 
	        	</p:column>
	        	<p:column headerText="Anio">
	        		<h:outputText value="#{cxc.anio}"/>
	        	</p:column>
		        <p:column headerText="Fecha">
		        <h:outputText value="#{cxc.fechaVoucher}"/>
		        </p:column>
		        <p:column headerText="Documento">
		            <p:cellEditor>  
		                <f:facet name="output"><h:outputText value="#{cxc.documento}" /></f:facet>  
		                <f:facet name="input"><p:inputText value="#{cxc.documento}" style="width:96%" label="Documento"/></f:facet>  
		            </p:cellEditor> 
		        </p:column>
		        <p:column headerText="Nro. Documento">
		        <h:outputText value="#{cxc.numeroVoucher}"/>
		        </p:column>
		        <p:column headerText="Concepto">
		        <h:outputText value="#{cxc.nombreConceptoPago}"/>
		        </p:column>
		        <p:column headerText="Debe">
		        <h:outputText value="#{cxc.montoDebe}"/>
		        </p:column>
		        <p:column headerText="Haber">
		        <h:outputText value="#{cxc.montoVoucher}"/>
		        </p:column>
		        <p:column headerText="Saldo">
		        <h:outputText value="#{cxc.montoVoucher}"/>
		        </p:column>
	        </p:dataTable>
  
	        </p:fieldset> 
	        <p:dialog widgetVar="dlgCtaDebe" header="Cuenta por Cobrar Debe">
	        <p:outputPanel id="opCxC">
	        <p:commandButton icon="ui-icon-check" title="Anadir Cuenta x cobrar tipo DEBE" update="dtCxC"
	        actionListener="#{gestionCxCController.anadirDebeACtasxCobrar}" oncomplete="dlgCtaDebe.hide();"/>
	        <p:fieldset>
	        <table><tr>
	        	<td><h:outputText value="Anio"/></td>
	        	<td><h:outputText value="Semestre"/></td><td><h:outputText value="Documento"/></td> 
	        	<td><h:outputText value="Concepto"/></td><td><h:outputText value="Mto. DEBE"/></td>
	        	</tr>
	        	<tr>
	        	<td><h:inputText style="width:50px;" value="#{gestionCxCController.ctaDebe.anio}"/></td>
	        	<td><h:selectOneMenu style="width:100%" value="#{gestionCxCController.ctaDebe.semestre}">  
		                    	<f:selectItem itemValue="" itemLabel="Escoja Semestre"/>
		                        <f:selectItem itemValue="Semestre 0" itemLabel="Semestre 0"/>
		                        <f:selectItem itemValue="Semestre 1" itemLabel="Semestre 1"/>
		                        <f:selectItem itemValue="Semestre 2" itemLabel="Semestre 2"/>  
		            </h:selectOneMenu></td>
		        <td><h:inputText value="#{gestionCxCController.ctaDebe.documento}"/>
		        </td> 
	        	<td><h:inputText style="width:100px;" value="#{gestionCxCController.ctaDebe.nombreConceptoPago}"/></td>
	        	<td><h:inputText style="width:60px;" value="#{gestionCxCController.ctaDebe.montoDebe}"/></td>
	        	</tr></table>
	        </p:fieldset>
	        </p:outputPanel>
	        </p:dialog>
 		</h:form>
 	</f:view>
	</ui:define>
</ui:composition>